/**
 * parentId 父菜单
 * name 菜单名称
 * type 菜单类型  
 * routeName 路由名称
 * routePath  路由路径
 * component 菜单组件
 * icon 菜单图标
 * sort 菜单排序
 * alwaysShow 始终显示
 * remark 菜单备注
 * children 子菜单
 * visible 菜单是否可见
 * createdAt 创建时间
 * updatedAt 更新时间
 * deletedAt 删除时间
 * 
 /**
 * @swagger
 * tags:
 *   name: Menu
 *   description: 菜单管理
 */
import {
  Entity,
  Column,
  PrimaryGeneratedColumn,
  CreateDateColumn,
  UpdateDateColumn,
  DeleteDateColumn,
  OneToMany,
} from 'typeorm';

@Entity('') //rolation
export class Menu {
  @PrimaryGeneratedColumn()
  id: string;
  @Column({ comment: '父级id' })
  parentId: number;
  @Column({ comment: '菜单是否可见', nullable: true })
  visible: number;
  @Column({ comment: '菜单名称', nullable: true })
  name: string;
  @Column({ comment: '路由名称', nullable: true })
  routeName: string;
  @Column({ comment: '路由路径', nullable: true })
  routePath: string;
  @Column({ comment: '菜单图标', nullable: true })
  icon: string;
  @Column({ comment: '组件路径', nullable: true })
  component: string;
  @Column({ comment: '备注', nullable: true })
  remark: string;
  @Column({ comment: '菜单类型', nullable: true })
  type: number;
  @Column({ comment: '排序', nullable: true })
  sort: number;
  @Column({ comment: '是否显示', nullable: true })
  alwaysShow: number;
  @Column({ comment: '权限标识', nullable: true })
  perm: string;
  @Column({ comment: '跳转路由', nullable: true })
  redirect: string;
  @Column({ comment: '缓存页面', nullable: true })
  keepAlive: number;
  @CreateDateColumn({ select: false })
  created_time: Date;
  @UpdateDateColumn({ select: false })
  updated_time: Date;
  @DeleteDateColumn({ select: false })
  deleted_time: Date;

  constructor(partial: Partial<Menu>) {
    Object.assign(this, partial);
  }
}
